<?php

/**
 * Gets all administrative roles
 * @package ModuleAdministratif
 * @version 1.0b
 * @return table
 */

session_start();

// Configuration file
include '../configuration.php';
// Functions
include '../inc/functions.php';

// Checking if user is logged in
if (!CheckSession()):
	exit();
endif;

// Include all objects
// TODO: Include only needed classes
foreach (glob($configuration['webroot'].'objects/*.php') as $class) { include_once $class; }

$credentials = new Credentials();
$credentialsList = $credentials->GetList(); ?>

<table cellpadding="0" cellspacing="0" border="0" class="table-objects">
	<tr>
		<th class="check"></th>
		<th>Rôle</th>
	</tr>
	<?php foreach ($credentialsList as $credentials) {
		$res  = '<tr>';
		$res .= '<td class="check"><input name="all" type="radio" value="'.$credentials->credentialsId.'"'.(($_POST['id'] == $credentials->credentialsId) ? ' checked="checked"' : '').' /></td>';
		$res .= '<td><span id="credentials-'.$credentials->credentialsId.'">'.$credentials->name.'</span></td>';
		$res .= '</tr>';
		echo $res;
	} ?>
</table>